package juc.design.guardedObject.TestGuardedObject3;


import lombok.extern.slf4j.Slf4j;

@Slf4j(topic = "c.postman")
class Postman extends Thread {
    private int id;
    private String mail;
    public Postman(int id, String mail) {
        this.id = id;
        this.mail = mail;
    }
    @Override
    public void run() {
        //送信完成，删除对应的等待
        GuardedObjectV3 guardedObjectV3 = Mailboxes.getGuardedObjectV3(id);
        log.debug("送信 id:{}, 内容:{}", id, mail);
        guardedObjectV3.complete(mail);
    }
}
